package cn.szsys.integration.constants;

/**
 * tianqushuzi(个人经济能力)映射码
 *
 * @author Ryan
 * @since 2025-05-07
 **/
public enum ZxyrResultMapperedEnum implements UpAndDownCodeBilled {
    /**
     * 下游
     * 0 - 表示查无
     * 1 - 表示查得
     * <p>
     * <p>
     * 下游
     * 0 - 表示查无
     * 1 - 表示查得
     */
    NONE("0", "0", false),
    HAS_RESULT("1", "1", true);
    private final String upstreamCode;
    private final String downstreamCode;
    private final Boolean billing;

    ZxyrResultMapperedEnum(String upstreamCode, String downstreamCode, Boolean billing) {
        this.upstreamCode = upstreamCode;
        this.downstreamCode = downstreamCode;
        this.billing = billing;
    }

    public static ZxyrResultMapperedEnum getByUpstreamCode(String upstreamCode) {
        for (ZxyrResultMapperedEnum resultEnum : ZxyrResultMapperedEnum.values()) {
            if (resultEnum.upstreamCode.equals(upstreamCode)) {
                return resultEnum;
            }
        }
        return NONE;
    }


    /**
     * 上游code
     */
    @Override
    public String getUpstreamCode() {
        return this.upstreamCode;
    }

    /**
     * 下游code
     */
    @Override
    public String getDownstreamCode() {
        return this.downstreamCode;
    }

    /**
     * 是否计费
     */
    @Override
    public Boolean getBilling() {
        return this.billing;
    }
}
